﻿using Architecture.Domain.Service;
using Architeture.Domain.DTO;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler
{
    public class UserSetRoleCommandHandler : IRequestHandler<UserSetRoleCommand, List<UserRoleChed>>
    {
        private readonly IUserService userService;

        public UserSetRoleCommandHandler(IUserService userService)
        {
            this.userService = userService;
        }

        public async Task<List<UserRoleChed>> Handle(UserSetRoleCommand request, CancellationToken cancellationToken)
        {
            return await userService.GetUserRoleched(request.id);
        }
    }
}
